package com.allo2o.common.convertor;

import org.springframework.beans.BeanUtils;

import com.allo2o.common.VO.MerchantUserVO;
import com.allo2o.common.domain.MerchantUserDO;

/**
 * <ul>
 * MerchantUser entity convertor
 * </ul>
 * Created by lubingbing on 16-4-29.
 */
public class MerchantUserConvertor {

    /**
     * vo to dto convertor
     *
     * @param vo MerchantUserVO
     * @return MerchantUserDO
     */
    public static MerchantUserDO VO2DOConvertor(MerchantUserVO vo) {
        if (vo == null) {
            return null;
        }
        MerchantUserDO dto = new MerchantUserDO();
        dto.setId(vo.getId());
        dto.setGmtCreate(vo.getGmtCreate());
        dto.setAccount(vo.getAccount());
        dto.setPassword(vo.getPassword());
        dto.setBoss(vo.getBoss());
        dto.setGmtModify(vo.getGmtModify());
        dto.setUserType(vo.getUserType());
        dto.setIsValid(vo.getIsValid());
        dto.setAvatar(vo.getAvatar());
        dto.setNickName(vo.getNickName());
        dto.setAgentId(vo.getAgentId());
        dto.setRecommendedPerson(vo.getRecommendedPerson());
        dto.setExt1(vo.getExt1());
        dto.setExt2(vo.getExt2());
        dto.setExt3(vo.getExt3());
        dto.setExt4(vo.getExt4());
        dto.setExt5(vo.getExt5());
        dto.setExt6(vo.getExt6());
        dto.setExt7(vo.getExt7());
        dto.setExt8(vo.getExt8());
        dto.setExt9(vo.getExt9());
        dto.setExt10(vo.getExt10());
        return dto;
    }

    /**
     * <ul>
     * dto to vo convertor
     * </ul>
     *
     * @param dto MerchantUserDO
     * @return MerchantUserVO
     */
    public static MerchantUserVO DO2VOConvertor(MerchantUserDO dto) {
        if (dto == null) {
            return null;
        }
        MerchantUserVO vo = new MerchantUserVO();
        BeanUtils.copyProperties(dto, vo);
        /*vo.setId(dto.getId());
        vo.setAccount(dto.getAccount());
        vo.setGmtModify(dto.getGmtModify());
        vo.setBoss(dto.getBoss());
        vo.setPassword("******");
        vo.setGmtCreate(dto.getGmtCreate());
        vo.setUserType(dto.getUserType());
        vo.setIsValid(dto.getIsValid());
        vo.setNickName(dto.getNickName());
        vo.setAvatar(dto.getAvatar());
        vo.setRecommendedPerson(dto.getRecommendedPerson());
        vo.setAgentId(dto.getAgentId());
        vo.setExt10(dto.getExt10());
        vo.setExt1(dto.getExt1());
        vo.setExt2(dto.getExt2());
        vo.setExt3(dto.getExt3());
        vo.setExt4(dto.getExt4());
        vo.setExt5(dto.getExt5());
        vo.setExt6(dto.getExt6());
        vo.setExt7(dto.getExt7());
        vo.setExt8(dto.getExt8());
        vo.setExt9(dto.getExt9());*/
        return vo;
    }
}
